package com.pomr.controller.common;

import com.pomr.entity.bigscr.BindInfo;
import com.pomr.entity.bigscr.PersonInfo;
import com.pomr.model.data.MonitorMessage;
import com.pomr.service.common.BigScrService;
import com.pomr.util.common.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @作者：wgchao
 * @时间：18:03 2019/6/13 0013
 * @用途：显示屏展示接口
 **/
@RestController
@RequestMapping("/big")
public class BigScrController {
    @Autowired
    private BigScrService bigScrService;

    /**
     * 分页查询患者信息-设备上传数据排行
     * @param curr 页码 从1开始
     * @param limit 行数 默认10
     * @return 患者信息列表
     */
    @RequestMapping(value = "/personinfo", method = RequestMethod.GET)
    public List<PersonInfo> searchPersonInfo(int curr, int limit) throws Exception{
        return bigScrService.searchPersonInfo(curr, limit);
    }

    /**
     *
     * @param idcard 身份证号
     * @param eName 设备名
     * @param spec 设备型号
     * @return 监测数据
     * @throws Exception
     */
    @RequestMapping(value = "/monitor", method = RequestMethod.GET)
    public List<MonitorMessage> searchMonitorByPerson(String idcard, String eName, String spec) throws Exception{
        return bigScrService.searchMonitorByPerson(idcard, eName, spec);
    }

    /**
     * 扫码领用设备
     * @param bindInfo
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "bind", method = RequestMethod.POST)
    public ResponseData bindfromsm(@RequestBody BindInfo bindInfo) throws Exception{
        return bigScrService.bindfromsm(bindInfo);
    }

    /**
     * 绑定第二用户
     * @param bindInfo
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "bindother", method = RequestMethod.POST)
    public ResponseData bindotherfromsm(@RequestBody BindInfo bindInfo) throws Exception{
        return bigScrService.bindotherfromsm(bindInfo);
    }
}
